package org.demo.patten.iterator;

/**
 * @author zhuj
 * @date 2025/3/29
 * @apiNote
 */
public class Main {
    public static void main(String[] args) {
        BookShelf shelf = new BookShelf();
        shelf.addBook(new Book("设计模式"));
        shelf.addBook(new Book("深入Java虚拟机"));
        shelf.addBook(new Book("重构"));
        Iterator<Book> iterator = shelf.createIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next().getName());
        }
    }
}
